/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ControlLayer;
import ModelLayer.*;
import DBLayer.*;
import java.util.ArrayList;
/**
 *
 * @author Henrik-iMac
 */
public class CtrPostalCity {

    //Creates a new instance of CtrPostalCity
    public CtrPostalCity(){

    }

    public ArrayList findAllCities()
    {
        IFDBPostalCity dbPostal = new DBPostalCity();
        ArrayList allPost = new ArrayList();
        allPost = dbPostal.getAllCities();
        return allPost;
    }

    public PostalCity findByZipCode(int zipCode)
    {
        IFDBPostalCity dbPost = new DBPostalCity();
        return dbPost.findCityZipCode(zipCode);
    }

    public PostalCity findByCityName(String city)
    {
        IFDBPostalCity dbPost = new DBPostalCity();
        return dbPost.findCityByName(city);
    }

    public int updatePostalCity(int zipCode, String city)
    {
        IFDBPostalCity dbPost = new DBPostalCity();
        PostalCity post = new PostalCity();
        post.setCity(city);
        post.setPostalCode(zipCode);
        return dbPost.updateCity(post);
    }

    public int insertPostalCity(PostalCity postObj)
    {
        IFDBPostalCity dbPost = new DBPostalCity();
        return dbPost.insertCity(postObj);
    }
}
